#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/types.h>

#define PATH	"/etc/"

int main(int argc, char *argv[])
{
	DIR *dir;
	struct dirent *dir_item;	
		
	dir = opendir(PATH);
	if(dir == NULL)
	{
		perror("opendir()");
		exit(1);
	}

	int i;
	for (i = 0; i < 4; i++) {
		printf("i = %d\n",i);
	}

	while ((dir_item = readdir(dir)) != NULL) {
		puts(dir_item->d_name);
	}

	closedir(dir);

	exit(0);
}
